package com.hongxun.design.bean;

import android.text.Editable;
import android.text.TextWatcher;

import java.util.ArrayList;
import java.util.List;

import com.hongxun.design.MyApp;
import com.hongxun.design.bean.photopassbean.SystemTypeBean;
import com.hongxun.design.constant.Constant;
import com.hongxun.design.mytools.MString;

/**
 * Created by zerdoor_pc on 2016/4/29.
 * 创建项目
 */
public class CreateProjectBean {

    private String name;//标题
    private String sendCode;//上传字段
    private String typeName;//所属的类别
    private int typeNum;//在类别中的位置当为0时显示类别
    private String value;//显示值
    private String[] valuearr;//
    private String valuecode;
    private int itemType;
    private String explorationer_id="";
    private int isWrite;//是否是输入框
    private ArrayList<String> data;//弹出框的数据
    private ArrayList<String> dataValue;//弹出框的数据code
    private ArrayList<SystemTypeBean> list;//弹出框的数据code

    public ArrayList<SystemTypeBean> getList() {
        return list;
    }

    public void setList(ArrayList<SystemTypeBean> list) {
        this.list = list;
    }

    private String activityType;//item点击后跳转的activity类型
    private String path;//语音path
    private TextWatcher textWatcher;//
    private boolean ismustInput;
    private CodeSetVersionBean codeSetVersion;
    private double[] lating;
    public double[] getLating() {
        return lating;
    }
    public void setLating(double[] lating) {
        this.lating = lating;
    }
    public CodeSetVersionBean getCodeSetVersion() {
        return codeSetVersion;
    }
    public void setCodeSetVersion(CodeSetVersionBean codeSetVersion) {
        this.codeSetVersion = codeSetVersion;
    }
    public CreateProjectBean() {
    }
    public Object obj;

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public CreateProjectBean(String sendCode, String name, String typeName, int typeNum, String value, int itemType, int isWrite, ArrayList<SystemTypeBean> list, String activityType, boolean ismustInput) {
        this.name = name;
        this.typeName = typeName;
        this.typeNum = typeNum;
        this.sendCode = sendCode;
        this.value = value;
        this.itemType = itemType;
        this.isWrite = isWrite;
        this.activityType = activityType;
        this.ismustInput = ismustInput;
        this.list = list;
        if (value.length()>0&&typeName.equals(Constant.项目团队人员)){
            valuecode=MyApp.userInfo.getUser_id();
            List<UserBean> beans=new ArrayList<>();
            UserBean b=new UserBean();
            b.setId(MyApp.userInfo.getUser_id());
            b.setRealname(value);
            b.setUsername(MyApp.userInfo.getUsername());
            beans.add(b);
            setObj(beans);
        }
        if (list != null && list.size() > 0) {
            this.data = new ArrayList<>();
            this.dataValue = new ArrayList<>();
            for (SystemTypeBean bean : list) {
                data.add(bean.getTypename());
                dataValue.add(bean.getTypecode());
            }
        }
        if (isWrite == Constant.CLICKEDTEXT) {
            setTextWatcher();
        }
        if (MString.address.equals(sendCode)&& MyApp.bdLocation!=null){
            this.value=MyApp.bdLocation.getAddrStr();
             setLating(new double[]{MyApp.bdLocation.getLongitude(), MyApp.bdLocation.getLatitude(), MyApp.bdLocation.getAltitude()});
        }
    }

    public TextWatcher getTextWatcher() {
        return textWatcher;
    }

    public void setTextWatcher() {
        TextWatcher textWatcher = new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                value = editable.toString();
            }
        };
        this.textWatcher = textWatcher;
    }


    public String getExplorationer_id() {
        return explorationer_id;
    }

    public void setExplorationer_id(String explorationer_id) {
        this.explorationer_id = explorationer_id;
    }

    public ArrayList<String> getData() {
        return data;
    }

    public void setData(ArrayList<String> data) {
        this.data = data;
    }

    public int getIsWrite() {
        return isWrite;
    }

    public void setIsWrite(int isWrite) {
        this.isWrite = isWrite;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public int getTypeNum() {
        return typeNum;
    }

    public void setTypeNum(int typeNum) {
        this.typeNum = typeNum;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    public int getItemType() {
        return itemType;
    }

    public void setItemType(int itemType) {
        this.itemType = itemType;
    }

    public String getValuecode() {
        return valuecode;
    }

    public void setValuecode(String valuecode) {
        this.valuecode = valuecode;
    }

    public ArrayList<String> getDataValue() {
        return dataValue;
    }

    public void setDataValue(ArrayList<String> dataValue) {
        this.dataValue = dataValue;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getActivityType() {
        return activityType;
    }

    public void setActivityType(String activityType) {
        this.activityType = activityType;
    }

    public boolean ismustInput() {
        return ismustInput;
    }

    public void setIsmustInput(boolean ismustInput) {
        this.ismustInput = ismustInput;
    }

    /**
     * 上传字段*
     */
    public String getSendCode() {
        return sendCode;
    }

    public void setSendCode(String sendCode) {
        this.sendCode = sendCode;
    }

    public String[] getValuearr() {
        return valuearr;
    }

    public void setValuearr(String[] valuearr) {
        this.valuearr = valuearr;
    }
}
